﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smartec.Accounts.Camel.AMS.Model.Entities;
using System.IO;
using System.Web.UI.WebControls;
using System.Web.UI;
using Smartec.Accounts.Camel.AMS.Model.Repository;
namespace Smartec.Accounts.Camel.AMS.Model.Facades
{
   public static class BannerFacade
    {
       public static void AddBanner(Banner banner)
       {
           BannerRepository.AddBanner(banner);
          
       }

       public static List<Banner> GetAllBanners()
       {
           return BannerRepository.All();
       }

       public static Banner GetBannerById(int id)
       {
           return BannerRepository.All().FirstOrDefault(t=>t.ID==id);
       }
       public static void Save()
       {
           BannerRepository.Save();
       }
       public static void UpdateBanner(Banner Banner)
       {
           var _Banner = GetBannerById(Banner.ID);
           _Banner.Image = Banner.Image;
           _Banner.URL = Banner.URL;
           _Banner.DisplayOrder = Banner.DisplayOrder;
       
           
       }

       public static void DeleteBannerById(int id)
       {
           BannerRepository.DeleteBannerById(id);
       }
    }
}
